home *** CD-ROM | disk | other *** search
/ SGI Hot Mix 8 / Hot Mix 8.iso / .all / demos / Soft_Win / InstallIt2 (.txt) < prev    next >
Text File  |  1994-06-22  |  16KB  |  540 lines

  1. #!/bin/sh
  2.  
  3. #    installit2
  4. #
  5. #    Derived from:    Template supplied by SGI for hot mix installation
  6. #            and the SoftPC HotMix scripts.
  7. #
  8. #    Author:        Anthony Shaughnessy
  9. #
  10. #    Created on:    7th April 1994
  11. #
  12. #    Sccs ID:    @(#)installit2.sh    1.13 4/26/94
  13. #
  14. #    Coding Stds.:    2.0
  15. #
  16. #    Purpose:    To act as a wrapper for the installation process from
  17. #            the hot mix CD. This script is called from InstallIt
  18. #            which opens a window as root to run this script in.
  19. #            This script asks various questions, calls instwrap
  20. #            which runs inst and supplies its input, and
  21. #            can optionally check your floppy drive and CD drive
  22. #            to see if it is configured correctly for SoftWindows
  23. #            - i.e. no msdosd or mediad running on it.
  24. #
  25.  
  26.  
  27. # We must first find out whether to use msdosd or mediad for floppy status
  28. # checks. We do this here so the getfloppy() function can print out the 
  29. # correct message.
  30.  
  31. if test -x /usr/etc/mediad
  32. then
  33.     CD_MEDIAPROG=/usr/etc/mediad
  34.     FLOP_MEDIAPROG=/usr/etc/mediad
  35.     CD_MEDIAPROGNAME=mediad
  36.     FLOP_MEDIAPROGNAME=mediad
  37. else
  38.     CD_MEDIAPROG=/usr/etc/cdromd
  39.     FLOP_MEDIAPROG=/usr/etc/msdosd
  40.     CD_MEDIAPROGNAME=cdromd
  41.     FLOP_MEDIAPROGNAME=msdosd
  42. fi
  43.  
  44. # getyesno() function to get a yes or no answer and no other from the user.
  45. # Loops until user has entered valid input. Returns the answer in $ANSWER
  46. # as either yes or no.
  47. # Accepts either y, n, yes, or no, in any mix of case.
  48. getyesno(){
  49. while read ANSWER
  50. do
  51.     ANSWER=`echo $ANSWER | tr '[A-Z]' '[a-z]'`
  52.     case $ANSWER in
  53.     y|yes)
  54.         ANSWER=yes
  55.         break
  56.         ;;
  57.     n|no)
  58.         ANSWER=no
  59.         break
  60.         ;;
  61.  
  62.     *)
  63.             echo "You must answer yes or no : \c"
  64.     esac
  65. done
  66. }
  67.  
  68. # Exit this script, displaying the message passed in $1, and asking the user
  69. # to press return before quitting.
  70. exit_wrapper(){
  71.     echo "\n$1"
  72.     echo "\nPress enter to exit this window...\c "
  73.     read ans
  74.     exit 1
  75. }
  76.  
  77. # Ask the user for a floppy device name. Allow a blank name - this means
  78. # that no checking for msdosd or mediad will be done.
  79. # Loops until either valid input is obtained, or a blank name is input.
  80. # The user can enter an incomplete pathname, in which case the script will
  81. # prepend first /dev, and then /dev/rdsk to try and find the file, which must
  82. # be readable and be a character special file.
  83. getfloppy(){
  84.  
  85.     # Check that the FLOP_MEDIAPROG variable is set to something.
  86.     if test -z "$FLOP_MEDIAPROG"
  87.     then
  88.         return
  89.     fi
  90.  
  91.     echo "\nTo use your floppy drive with SoftWindows, the $FLOP_MEDIAPROGNAME daemon must 
  92. not be running on that floppy drive. So that I can check whether the
  93. $FLOP_MEDIAPROGNAME daemon is running on the floppy drive, please enter the name of
  94. the floppy device you will be using with SoftWindows and press enter. 
  95. If you do not specify any device, then no checking will be done.
  96. On an Indigo    Enter /dev/rdsk/fds0d2.3.5hi for the middle slot,
  97.         or    /dev/rdsk/fds0d3.3.5hi for the top slot.
  98. On an Indy    Enter /dev/rdsk/fds0d2.3.5hi."
  99.  
  100.     while echo "Please enter the floppy device name : \c"
  101.     do
  102.         read FLOPPY
  103.  
  104.         # first test for blank entry - break if blank
  105.         if test -z "$FLOPPY"
  106.         then
  107.             break
  108.         fi
  109.  
  110.         # Look for the file. If you can't find it as $FLOPPY
  111.         # then look for it as /dev/$FLOPPY, and then /dev/rdsk/$FLOPPY
  112.         if test ! -r "$FLOPPY"
  113.         then
  114.             if test ! -r /dev/"$FLOPPY"
  115.             then
  116.                 if test ! -r /dev/rdsk/"$FLOPPY"
  117.                 then
  118.                     echo "Floppy device $FLOPPY does not exist or is not readable."
  119.                     continue
  120.                 else
  121.                     FLOPPY="/dev/rdsk/$FLOPPY"
  122.                 fi
  123.             else
  124.                 FLOPPY="/dev/$FLOPPY"
  125.             fi
  126.         fi
  127.         if test ! -c "$FLOPPY"
  128.         then
  129.             echo "The floppy device $FLOPPY must be a character special device."
  130.         else
  131.             echo "\nUsing device name $FLOPPY"
  132.             break
  133.         fi
  134.     done
  135. }
  136.  
  137. # Ask the user for a CD device name. Allow a blank name - this means
  138. # that no checking for cdromd or mediad will be done.
  139. # Loops until either valid input is obtained, or a blank name is input.
  140. # The user can enter an incomplete pathname, in which case the script will
  141. # prepend first /dev, and then /dev/scsi to try and find the file, which must
  142. # be readable and be a character special file.
  143. getcdrom(){
  144.  
  145.     # Check that the CD_MEDIAPROG variable is set to something.
  146.     if test -z "$CD_MEDIAPROG"
  147.     then
  148.         return
  149.     fi
  150.  
  151.     echo "\nTo use your CD-ROM drive with SoftWindows, the $CD_MEDIAPROGNAME daemon must 
  152. not be running on that CD-ROM drive. So that I can check whether the
  153. $CD_MEDIAPROGNAME daemon is running on the CD-ROM drive, please enter the name of
  154. the CD-ROM device you will be using with SoftWindows and press enter. 
  155. If you do not specify any device, then no checking will be done.
  156. The CD ROM device name should be of the form /dev/scsi/sc0dxl0, where x is
  157. the SCSI address of the CD drive (between 0 and 7)."
  158.  
  159.     while echo "Please enter the CD-ROM device name : \c"
  160.     do
  161.         read CDROM
  162.  
  163.         # first test for blank entry - break if blank
  164.         if test -z "$CDROM"
  165.         then
  166.             break
  167.         fi
  168.  
  169.         # Look for the file. If you can't find it as $CDROM
  170.         # then look for it as /dev/$CDROM, and then /dev/scsi/$CDROM
  171.         if test ! -r "$CDROM"
  172.         then
  173.             if test ! -r /dev/"$CDROM"
  174.             then
  175.                 if test ! -r /dev/scsi/"$CDROM"
  176.                 then
  177.                     echo "CD-ROM device $CDROM does not exist or is not readable."
  178.                     continue
  179.                 else
  180.                     CDROM="/dev/scsi/$CDROM"
  181.                 fi
  182.             else
  183.                 CDROM="/dev/$CDROM"
  184.             fi
  185.         fi
  186.         if test ! -c "$CDROM"
  187.         then
  188.             echo "The CD-ROM device $CDROM must be a character special device."
  189.         else
  190.             echo "\nUsing device name $CDROM"
  191.             break
  192.         fi
  193.     done
  194. }
  195.  
  196.  
  197. echo "Before continuing, you must have obtained a demo license from Insignia."
  198. echo "Have you done this? y/n : \c"
  199. getyesno
  200.  
  201. test $ANSWER = no && {
  202.     exit_wrapper "You must obtain a demo license before installing SoftWindows.
  203. USA customers please call 800 848 7677.
  204. European customers please call +44 494 459 426
  205. All other customers please call +1 415 694 7677"
  206. }
  207.  
  208. echo "\nInstalling SoftWindows. This may take a little while. 
  209. Please wait until prompted before typing anything."
  210.  
  211.  
  212. # Call instwrap which will run inst and supply the input to inst so that the
  213. # user doesn't have to type anything.
  214. $SOFTWINDIR/instwrap $SOFTWINDIR
  215. ERRCODE=$?
  216. test $ERRCODE -ne 0 && {
  217.     exit_wrapper "SoftWindows was not installed correctly"
  218. }
  219.  
  220.  
  221. # Make sure that SoftWindows is there now - we can't trust the error code 
  222. # returned by instwrap, so we double check
  223. # Check each package in turn. If the core package is not installed, then exit.
  224. # If any of the others are not there, then just give a message.
  225.  
  226. if versions swin.sw.eoe | grep "Nothing satisfies" > /dev/null
  227. then
  228.         exit_wrapper "The SoftWindows core package was not installed correctly.
  229. You will not be able to run SoftWindows."
  230. fi
  231.  
  232. MISSING_PACKAGE=false
  233. if versions swin.man.eoe | grep "Nothing satisfies" > /dev/null
  234. then
  235.     echo "The SoftWindows manual pages have not been installed."
  236.     MISSING_PACKAGE=true
  237. fi
  238.  
  239. if versions swin.man.relnotes | grep "Nothing satisfies" > /dev/null
  240. then
  241.     echo "The SoftWindows release notes package was not installed.
  242. See the README files in /usr/lib/SoftWindows for release notes instead."
  243.     MISSING_PACKAGE=true
  244. fi
  245.  
  246. if versions swin.sw.windows | grep "Nothing satisfies" > /dev/null
  247. then
  248.     echo "The MS Windows installation files have not been installed.
  249. You will still be able to use the pre-installed Windows disk to run MS Windows."
  250.     MISSING_PACKAGE=true
  251. fi
  252.  
  253. if versions swin.sw.local | grep "Nothing satisfies" > /dev/null
  254. then
  255.     echo "The Fonts and Localisation package has not been installed.
  256. You will be able to run SoftWindows on your SGI machine, but may not be able
  257. to use any other display servers."
  258.     MISSING_PACKAGE=true
  259. fi
  260.  
  261. if test $MISSING_PACKAGE = true
  262. then
  263.     echo "\nNot all of the ancillary SoftWindows packages have been installed,
  264. but the core package has been installed successfully, and you will be able to 
  265. run SoftWindows"
  266. fi
  267.  
  268. if test -n "$FLOP_MEDIAPROG"
  269. then
  270.     # Get the floppy drive device name. Allow blank entry
  271.     getfloppy
  272.  
  273.     SKIP=false
  274.  
  275.     # If floppy device name entered, then do msdosd or mediad checks.
  276.     if test $FLOPPY
  277.     then
  278.         # Get the floppy status with msdosd -q or mediad -q
  279.         # The return status is a bit mask. See the msdosd or
  280.         # mediad man page.
  281.  
  282.         $FLOP_MEDIAPROG -q $FLOPPY
  283.         RETVAL=$?
  284.  
  285.         # The bit program will set environment variables 
  286.         # called BIT[0123]SET to either true or false depending 
  287.         # on whether the corresponding bit is set.
  288.         eval `$SOFTWINDIR/bit $RETVAL`
  289.  
  290.         # We now have the variables BIT[0123]SET set to either true 
  291.         # or fale
  292.  
  293.         # Bit 0 means error occurred
  294.         if test $BIT0SET = true
  295.         then
  296.  
  297.     echo "\nAn error occurred while investigating the status of the floppy drive.
  298. No checking on the floppy status will be done.
  299. You may need to kill the $FLOP_MEDIAPROGNAME daemon manually."
  300.  
  301.         elif test $RETVAL -ne 0
  302.         then
  303.  
  304.             # Bit 1 means msdosd or mediad is running for that 
  305.             # device
  306.             if test $BIT1SET = true
  307.             then
  308.     echo "\nDo you want to kill the $FLOP_MEDIAPROGNAME daemon attached to $FLOPPY ? (y/n): \c"
  309.                 getyesno
  310.                 if test $ANSWER = yes
  311.                 then
  312.                     if test $FLOP_MEDIAPROG = /usr/etc/msdosd
  313.                     then
  314.                         $FLOP_MEDIAPROG -k $FLOPPY
  315.                     else
  316.                         $FLOP_MEDIAPROG -k
  317.                     fi
  318.                     echo "Waiting for $FLOP_MEDIAPROGNAME to die..."
  319.                     sleep 5
  320.                 else
  321.                     SKIP=true
  322.                 fi
  323.             fi
  324.  
  325.             if test $SKIP = false
  326.             then
  327.             # We have to test bit 3 before bit 2, because if the
  328.             # floppy has been mounted manually, then bit 2 will not
  329.             # be set even if there is an fsd.auto entry. So we
  330.             # do another msdosd -q to see if the floppy has been
  331.             # unmounted, and use the return value of that to check
  332.             # for the fsd.auto entry.
  333.  
  334.             # NOTE that bit 3 is not set when using mediad, so we
  335.             # have to check by running mount.
  336.  
  337.             # Bit 3 means the floppy has been mounted manually
  338.                 if test $BIT3SET = true || mount | grep $FLOPPY > /dev/null 2>&1
  339.                 then
  340. echo "\nThe floppy device $FLOPPY has been mounted manually.
  341. Would you like it unmounted? (y/n): \c"
  342.                     getyesno
  343.                     if test $ANSWER = yes
  344.                     then
  345.                         umount $FLOPPY
  346.                         $FLOP_MEDIAPROG -q $FLOPPY
  347.                         RETVAL=$?
  348.                         eval `$SOFTWINDIR/bit $RETVAL`
  349.                         if test $BIT3SET = true || mount | grep $FLOPPY > /dev/null 2>&1
  350.                         then
  351. echo "\nThe unmount of the floppy device $FLOPPY failed.
  352. You will need to unmount the floppy manually to use it with SoftWindows,
  353. or you may access it as an FSA drive instead."
  354.                             SKIP=true
  355.                         fi
  356.                     else
  357. echo "\nIf you wish to use this floppy drive with SoftWindows, you must either
  358. unmount it manually, or you may use it as an FSA drive instead."
  359.                         SKIP=true
  360.                     fi
  361.                 fi
  362.  
  363.                 if test $SKIP = false
  364.                 then
  365.                 # Bit 2 means there is an /etc/fsd.auto entry
  366.                 # but we have to check to see if mon=on or off
  367.                 # for the mediad case
  368.                     if test $BIT2SET = true
  369.                     then
  370.                         if test $FLOP_MEDIAPROG = /usr/etc/msdosd || egrep "^$FLOPPY" /etc/fsd.auto | grep -v mon=off > /dev/null
  371.                         then
  372. echo "\nAn entry exists for this floppy device in /etc/fsd.auto.
  373. Do you wish to remove this entry? (y/n): \c"
  374.                             getyesno
  375.                             if test $ANSWER = yes
  376.                             then
  377.                                 $FLOP_MEDIAPROG -r $FLOPPY
  378.                             fi
  379.                         fi
  380.                     fi
  381.  
  382.                 fi    # SKIP = false
  383.  
  384.             fi    # SKIP = false
  385.         else
  386.             echo "\nThere is no $FLOP_MEDIAPROGNAME running on this floppy device."
  387.         fi    # ERR_CHECK = -1
  388.  
  389.     fi    # test $FLOPPY
  390. fi
  391.  
  392. if test -n "$CD_MEDIAPROG"
  393. then
  394.     # Get the CD drive device name. Allow blank entry
  395.     getcdrom
  396.  
  397.     SKIP=false
  398.  
  399.     # If CD-ROM device name entered, then do cdromd or mediad checks.
  400.     if test $CDROM
  401.     then
  402.         # Get the CD-ROM status with cdromd -q or mediad -q
  403.         # The return status is a bit mask. See the cdromd or
  404.         # mediad man page.
  405.  
  406.         $CD_MEDIAPROG -q $CDROM
  407.         RETVAL=$?
  408.  
  409.         # The bit program will set environment variables 
  410.         # called BIT[0123]SET to either true or false depending 
  411.         # on whether the corresponding bit is set.
  412.         eval `$SOFTWINDIR/bit $RETVAL`
  413.  
  414.         # We now have the variables BIT[0123]SET set to either true 
  415.         # or fale
  416.  
  417.         # Bit 0 means error occurred
  418.         if test $BIT0SET = true
  419.         then
  420.  
  421. echo "\nAn error occurred while investigating the status of the CD-ROM drive.
  422. No checking on the CD-ROM status will be done.
  423. You may need to kill the $CD_MEDIAPROGNAME daemon manually."
  424.  
  425.         elif test $RETVAL -ne 0
  426.         then
  427.  
  428.             # Bit 1 means msdosd or mediad is running for that 
  429.             # device
  430.             if test $BIT1SET = true
  431.             then
  432. echo "\nDo you want to kill the $CD_MEDIAPROGNAME daemon attached to $CDROM ? (y/n): \c"
  433.                 getyesno
  434.                 if test $ANSWER = yes
  435.                 then
  436.                     if test $CD_MEDIAPROG = /usr/etc/cdromd
  437.                     then
  438.                         $CD_MEDIAPROG -k $CDROM
  439.                     else
  440.                         $CD_MEDIAPROG -k
  441.                     fi
  442.                     echo "Waiting for $CD_MEDIAPROGNAME to die..."
  443.                     sleep 5
  444.                 else
  445.                     SKIP=true
  446.                 fi
  447.             fi
  448.  
  449.             if test $SKIP = false
  450.             then
  451.             # We have to test bit 3 before bit 2, because if the
  452.             # floppy has been mounted manually, then bit 2 will not
  453.             # be set even if there is an fsd.auto entry. So we
  454.             # do another cdromd -q to see if the cdrom has been
  455.             # unmounted, and use the return value of that to check
  456.             # for the fsd.auto entry.
  457.  
  458.             # Bit 3 means the cdrom has been mounted manually
  459.                                 RDSK_NAME=`echo $CDROM | sed -e 's/\/dev\/scsi\/sc/\/dev\/dsk\/dks/' -e 's/l0$/s7/'`
  460.                 if test $BIT3SET = true || mount | egrep "$RDSK_NAME|$CDROM" > /dev/null 2>&1
  461.                 then
  462. echo "\nThe CD-ROM device $CDROM has been mounted manually.
  463. Would you like it unmounted? (y/n): \c"
  464.                     getyesno
  465.                     if test $ANSWER = yes
  466.                     then
  467.                         umount $RDSK_NAME > /dev/null 2>&1
  468.                         umount $CDROM > /dev/null 2>&1
  469.                         $CD_MEDIAPROG -q $CDROM
  470.                         RETVAL=$?
  471.                         eval `$SOFTWINDIR/bit $RETVAL`
  472.                         if test $BIT3SET = true || mount | egrep "$RDSK_NAME|$CDROM" > /dev/null 2>&1
  473.                         then
  474. echo "\nThe unmount of the CD-ROM device $CDROM failed.
  475. You will need to unmount the CD-ROM manually to use it with SoftWindows,
  476.     or you may access it as an FSA drive instead."
  477.                             SKIP=true
  478.                         fi
  479.                     else
  480. echo "\nIf you wish to use this CD-ROM drive with SoftWindows, you must either
  481. unmount it manually, or you may use it as an FSA drive instead."
  482.                         SKIP=true
  483.                     fi
  484.                 fi
  485.  
  486.                 if test $SKIP = false
  487.                 then
  488.                 # Bit 2 means there is an /etc/fsd.auto entry
  489.                 # but we have to check whether mon=on or off
  490.                 # for the mediad case.
  491.                     if test $BIT2SET = true
  492.                     then
  493.                         if test $CD_MEDIAPROG = /usr/etc/cdromd || egrep "^$CDROM" /etc/fsd.auto | grep -v mon=off > /dev/null
  494.                         then
  495. echo "\nAn entry exists for this CD-ROM device in /etc/fsd.auto.
  496. Do you wish to remove this entry? (y/n): \c"
  497.                             getyesno
  498.                             if test $ANSWER = yes
  499.                             then
  500.                                 $CD_MEDIAPROG -r $CDROM
  501.                             fi
  502.                         fi
  503.                     fi
  504.  
  505.                 fi    # SKIP = false
  506.             fi
  507.         else
  508.             echo "\nThere is no $CD_MEDIAPROGNAME running on this CD-ROM device."
  509.         fi    # ERR_CHECK = -1
  510.  
  511.     fi    # test $CDROM
  512. fi
  513.  
  514.  
  515. # All installed OK.
  516.  
  517. $SOFTWINDIR/InstallIt3
  518.  
  519. echo "\n\nTo run SoftWindows, use the \"Find icon\" workspace menu option, and
  520. find the icon for /usr/lib/SoftWindows/bin/SoftWindows. Drag this icon onto
  521. the desktop, and double click on it.
  522. If you wish to run SoftWindows from a shell window, type the following:
  523.  
  524.     /usr/lib/SoftWindows/bin/SoftWindows &
  525.  
  526. To use your floppy drive with SoftWindows, from the SoftWindows Options menu 
  527. select Disk Drives > Open Drive... In either of the floppy drive A: or B: 
  528. Device File Name boxes enter the floppy device name.
  529. On an Indigo    Enter /dev/rdsk/fds0d2.3.5hi for the middle slot
  530.         or    /dev/rdsk/fds0d3.3.5hi for the top slot.
  531. On an Indy    Enter /dev/rdsk/fds0d2.3.5hi.
  532. To use a CD-ROM drive, enter /dev/rdsk/dks0dXvol, where X is the SCSI address
  533. of the drive, in the same dailog box.
  534. This information is also in the file /usr/lib/SoftWindows/README.SGI
  535. Press enter to exit this window.\c"
  536.  
  537. read ans
  538.  
  539. exit 0
  540.